JavaScript

mapControl.getMarkerGroupPositions Method

Syntax

mapObj.getMarkerGroupPositions(markerGroup1 [, ...markerGroupN]);

Arguments

markerGroup1string

The marker group to get the latitude/longitude. Can be specified as a string containing the name of a single marker group or an array of marker groups.

markerGroupNstring

Additional marker group to get the latitude/longitude. You can specify as many marker groups as you want, separated by commas.

Returns

resultobject array

Returns a JavaScript object of key-value pairs where the key is the marker name and the value is an array that contains the latitude and longitude values of the marker's location.

Description

Get the latitude/longitude of all the markers in one or more marker groups on the map.

Discussion

The method will return a JavaScript object where the name of the marker is used as the key for the marker's latitude/longitude. For example, if you have a marker named 'myMarker1', the JavaScript would have a property named 'myMarker1'. The value for 'myMarker1' would be an array of latitude and longitude values.

Example

//get a pointer to the map control for variable 'mymap1'
var mapObj = {dialog.object}.getControl('mymap1');

if (mapObj) {
    var markers = mapObj.getMarkerGroupPositions('myMarkerGroup1','myMarkerGroup2');
    var msg = ""

    for (var marker in markers) {
        var markerLoc = markers[marker];
        msg = msg + "Marker '"+marker+"': "+markerLoc[0]+","+markerLoc[1];
    }

    A5.msgBox.show("Markers in Groups",msg,"o");
}